import static org.junit.Assert.*;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

import junit.framework.*;

public class Test 
{
	Dealer testDealer;
	@org.junit.Test
	public void testIsWinner()
	{
		testDealer = new Dealer(5000, 20, 2);
		testDealer.initializaleAuctionTable();
		assertEquals("Kilka osob przeszlo licytacje - ok!", true, testDealer.isWinner());
	}
	public void testCreatePlayer() throws FileNotFoundException
	{
		testDealer = new Dealer(5000, 20, 1);
        PrintWriter writer = new PrintWriter("5000");
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        testDealer.createPlayer("Jan", writer, reader, true);
        assertEquals("Nazwa gracza OK!", "Jan", testDealer.getPlayerName(0));
	}
	public void testCardConstructor()
	{
		Card[] cards = new Card[4];
		cards[0]= new Card(13, "HEART");
		cards[1] = new Card(12, "DIAMOND");
		cards[2] = new Card(12, "CLUB");
		cards[3] = new Card(2, "CLUB");
		int counter = 0;
		
		if ( ( cards[0].getNumber() + cards[0].getColor() ).equals("13HEART") ) counter += 1;
		if ( ( cards[1].getNumber() + cards[1].getColor() ).equals("12DIAMOND") ) counter += 1;
		if ( ( cards[2].getNumber() + cards[2].getColor() ).equals("12CLUB") ) counter += 1;
		if ( ( cards[3].getNumber() + cards[3].getColor() ).equals("13HEART") ) counter += 1;
		assertEquals("Poprawnie stworzono karty!", 4, counter);
	}
	public void testChoiceSet() // testuje przypadek case3 tej metody
	{
		Card[] xcards = new Card[4];
		xcards[0]= new Card(2, "SPADE");
		xcards[1] = new Card(13, "SPADE");
		xcards[2] = new Card(1, "SPADE");
		xcards[3] = new Card(5, "SPADE");
		Hand hand = new Hand(xcards);
		xcards=hand.choiceSet(xcards);
		assertEquals( "Wybrano najlepszy uklad!", "1SPADE", (xcards[0].getNumber() + xcards[0].getColor()) );
		
	}

}
